package com.bdqn.t296.noso.service.Imp;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.bdqn.t296.noso.entity.CCashier;
import com.bdqn.t296.noso.entity.CPharmacy;
import com.bdqn.t296.noso.entity.CReport;
import com.bdqn.t296.noso.entity.ReportVo;
import com.bdqn.t296.noso.mapper.CCashierMapper;
import com.bdqn.t296.noso.mapper.PrescriMapper;
import com.bdqn.t296.noso.service.PrescriService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class PrescriServiceImp implements PrescriService {
    @Resource
    PrescriMapper prescriMapper;
    @Resource
    CCashierMapper cCashierMapper;

    //模糊分页查询
    @Override
    public IPage<ReportVo> mobu(Page<ReportVo> page, ReportVo reportVo) {
        return prescriMapper.mobu(page, reportVo);
    }

    //查询用户有没有病例
    @Override
    public String selbing(Integer rid) {
        return prescriMapper.selbing(rid);
    }

    //添加用户病例
    @Override
    public int addbing(CReport cReport) {
        return prescriMapper.addbing(cReport);
    }

    //查询所有药品
    @Override
    public IPage<CPharmacy> selpharm(Page<CPharmacy> page, CPharmacy cPharmacy) {
        return prescriMapper.selpharm(page, cPharmacy);
    }

    //查询这个用户的处方表上有没有这个药
    @Override
    public Integer selcadr(CCashier cCashier) {
        return prescriMapper.selcadr(cCashier);
    }

    //没有添加处方药品处方
    @Override
    public Integer addchu(CCashier cCashier) {
        return prescriMapper.addchu(cCashier);
    }

    //如果有该药品则改变该药品的数量
    @Override
    public Integer updchu(CCashier cCashier) {
        return prescriMapper.updchu(cCashier);
    }

    //查询当前患者药品处方
    @Override
    public IPage<CCashier> selpepi(Page<CCashier> page, Integer reportId) {
        return prescriMapper.selpepi(page, reportId);
    }

    //查询当前患者所有处方
    @Override
    public IPage<CCashier> selall(Page<CCashier> page, Integer reportId) {
        return prescriMapper.selall(page, reportId);
    }

    //删除处方中的药品
    @Override
    public Integer del(Integer cashier) {
        return cCashierMapper.deleteById(cashier);
    }

    //减少药房中的数量
    @Override
    public Integer deldrunum(CPharmacy cPharmacy) {
        return prescriMapper.deldrunum(cPharmacy);
    }

    //添加药房中的数量
    @Override
    public Integer adddrunum(CPharmacy cPharmacy) {
        return prescriMapper.adddrunum(cPharmacy);
    }

    //查询用户做项目的结果
    @Override
    public String lookbing(Integer reid) {
        return null;
    }

    //查询该用户是否还有未交钱的项目
    @Override
    public int seljiao(Integer reid) {
        return prescriMapper.seljiao(reid);
    }

    //查看该用户有几个已经做过的项目
    @Override
    public Integer selyi(Integer reid) {
        return prescriMapper.selyi(reid);
    }

    //查询该用户有几个已经交过钱的项目
    @Override
    public Integer selgong(Integer reid) {
        return prescriMapper.selgong(reid);
    }

    //查询用户项目的处方
    @Override
    public IPage<CCashier> selximu(Page<CCashier> page, Integer reportId) {
        return prescriMapper.selximu(page, reportId);
    }
}
